package cn.zjj.downgrade;

import cn.zjj.domain.Product;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.HashMap;
import java.util.Map;

public class DowngradeUtils {
    /*
     * @Description: 服务降级方法
     * @param e: 服务降级方法必须接收的异常参数
     * @return: cn.zjj.domain.User
     **/
    public static Map<String,Object> blockMethod(@RequestBody Product product,BlockException e){
        e.printStackTrace();
        Map<String, Object> map = new HashMap<>();
            map.put("success",false);
            map.put("message","请勿频繁访问");
            map.put("state",421);
        return map;
    }

}
